Editable HTML provides a way to make divs of your HTML content editable.
The behavior of Editable HTML is very similar to the
The user interface of Editable HTML is either be based on mouse clicks and keyboard events of based on buttons. Let's go through the different options.
Below are two divs with a border. Each div can be edited by clicking inside the divs area.
The first div is implemented using the build-in browser/html feature
Notice the different behavior of the two divs
(1) In EditableHTML you have to press 'Ctrl' key and click inside the div to make it editable. This shall avoid unintentional changes to edit mode.
(2) Editable HTML will set the divs innerHTML back to its original value, when click outside the div to avoid unintential changes. The buld-in feature will save your input and the original value gets lost.
(3) In this example, Editable HTML will only save your input when you press 'Ctrl + Enter' or 'Ctrl + Blankspace'. Each input must be confirmed by a dedicated user action, that makes it unlikey to happen by mistake.
HTML
I your html you need to add the class
In your script section, you need to call the function
Here's the example with three multiple editable divs inside the node container, containing the class
In this variant, the three text divs are connected. They form one logical edit unit, which are saved or discarded together.
The editable divs need to be children of
In this example the user interface is based on buttons. Mouse clicks on the editable div and keyboard events are disabled here.
The class
To minimize html code, the buttons edit and save are by befault identified as the first and second child of the
In this example the discard button is a seperate element. To link the discard button with its corresponding editable div, and button container
the data
So either the class
Same logic as above. You can have multiple editable divs can be placed inside a node container. The button actions applay to all divs inside the node
....
{{svg-icon-edit-18}}
|
some text | some other text | some other text | some other text |
{{svg-icon-edit-18}}
|
some text | some other text | some other text | some other text |
{{id-end-index}}